package com.ruoyi.common.utils;

public class SentenceFormatter {
    public static String capitalizeFirstLetter(String str) {
        if (str == null || str.isEmpty()) {
            return str;
        }
        str = str.replaceAll("bird’s eye view","downward angle");
        if (str != null && str.startsWith("\uFEFF")) {
            str = str.substring(1);
        }
        String[] sentences = str.split("\\. ");
        StringBuilder result = new StringBuilder();

        for (int i = 0; i < sentences.length; i++) {
            String sentence = sentences[i].trim(); // 去除前后空格
            if (!sentence.isEmpty()) {
                result.append(Character.toUpperCase(sentence.charAt(0)))
                        .append(sentence.substring(1).toLowerCase());
                if (i < sentences.length - 1) {
                    result.append(". "); // 只在不是最后一句时添加句点
                }
            }
        }

        return result.toString();

    }
    public static String removePunctuation(String input) {
        return input.replaceAll("。", "");

    }



    public static void main(String[] args) {
        String text = "\uFEFF picture taken from the front, under normal light, the young man is facing the camera, with a serious expression and no smile. He was wearing green headphones and he was wearing a white t-shirt.";
       String result= capitalizeFirstLetter(text);

        // 输出结果
        System.out.println(result.toString());

    }
}
